﻿// JScript 文件

 var isHide = true;
  
  function BuildOrder()
   {
        ShowMask();
        var innerHtml ="<div id='toolBar' onmousedown='divBlock_event_mousedown()'><img src='../Icon/close.gif'  onclick='HideOrder()'/></div><div id='div_header' class='Order_Header'>订单</div>"+
       +
        "<br><input type='button' onclick='Subscribe()' value='提交'/></div>";
        
        
    
     
        new Insertion.Bottom('div_order',innerHtml);
        
   }
   
   function BasicOrder()
   {
        
   }
   BasicOrder.prototype.BuildHeader = function(){new Insertion.Bottom($('div_order'),"<div id='div_header' class='Order_Header'>订单</div>")};
   BasicOrder.prototype.BuildContext=function(){ new Insertion.Bottom($('div_order'),"<div id='div_contex'>"+$('tableNum')+$('Day')+$('Memo')+"</div>")};
   BasicOrder.prototype.BuildFooter=function(){new Insertion.Bottom($('div_order'),"<div id='div_footer' class='Order_Footer'></div>")};
   
   
   
   
   function AddClass()
   {
        $('div_order').addClassName('div_order');
        $('div_order').addClassName('O_Header');
   }
   
   
  
function divBlock_event_mousedown()
{ 
var e, obj, temp;
obj=document.getElementById('div_order');  
e=window.event?window.event:e;
obj.startX=e.clientX-obj.offsetLeft;  
obj.startY=e.clientY-obj.offsetTop;  
document.onmousemove=document_event_mousemove;  
temp=document.attachEvent?document.attachEvent('onmouseup',document_event_mouseup):document.addEventListener('mouseup',document_event_mouseup,'');
}
  
  
function document_event_mousemove(e)
{
var e, obj;  
obj=document.getElementById('div_order'); 
e=window.event?window.event:e;   
with(obj.style){  
    position='absolute';  
    left=e.clientX-obj.startX+'px';  
    top=e.clientY-obj.startY+'px'; 
    }
}

function document_event_mouseup(e)
{ 
var temp; 
document.onmousemove='';
temp=document.detachEvent?document.detachEvent('onmouseup',document_event_mouseup):document.removeEventListener('mouseup',document_event_mouseup,'');
}

function HideOrder()
{
   
    var m = $('mask'); 
    m.style.visibility='hidden'; 
    
    var od = $('div_order'); 
    od.style.visibility='hidden'; 
    enableSelect(); 
}



function Subscribe()
{
alert('arrive='+$('Day').value+"&tableNum="+$('tableNum').value+"+&resID=3&memo="+$('Memo').value+"&UID=2");
   var URL="/Subscribe.asmx/AddDiscountOrder";
    new Ajax.Request("http://"+location.host+"/Solution"+URL, {

  method: 'post',
  parameters:'arrive='+$('Day').value+"&tableNum="+$('tableNum').value+"&resID=3&memo="+$('Memo').value+"&UID=2",
  onSuccess: function(transport) {alert(transport.responseText);},
  onFailure:function(transport){alert(transport.responseText);}

});

}


function disableSelect()
{   
        for(i=0;i<document.all.length;i++)  
              if(document.all(i).tagName=="SELECT")
                document.all(i).disabled = true;
 } 
 
function enableSelect()
{
    for(i=0;i<document.all.length;i++){   
              if(document.all(i).tagName=="SELECT")
              {
                document.all(i).disabled = false;
              }
        }   
}  

function ShowMask()
{
    var m = $('mask');
    var od = $('div_order'); 
    m.style.width = document.body.clientWidth ;
    m.style.height=document.body.clientHeight;
    disableSelect()
    m.style.visibility='visible';
    od.style.visibility='visible';
}



